local xianyan = fk.CreateSkill{
  name = "rfenghou_3d17j__xianyan&",
}

xianyan:addEffect("active", {
  anim_type = "big",
  card_num = 0,
  card_filter = Util.FalseFunc,
  target_num = 1,
  target_filter = function(self, player, to_select, selected)
    return #selected == 0 and to_select:getMark("@[rfenghou_3d17j__lanjiao]rfenghou_3d17j__lanjiao") ~= 0 and not table.contains(to_select:getTableMark("_rfenghou_3d17j__xianyan"), player.id)
  end,
  prompt = function(self, player, _, selected_targets)
    if #selected_targets == 1 then
      local target = selected_targets[1]
      local mark = target:getMark("@[rfenghou_3d17j__lanjiao]rfenghou_3d17j__lanjiao")
      local arr = mark.all
      local pos = mark.pos
      if arr[pos] then
        return "#rfenghou_3d17j__xianyan&:::" .. arr[pos]
      else
        return "#rfenghou_3d17j__xianyan&-change"
      end
    end
    return "#rfenghou_3d17j__xianyan&0"
  end,
  on_use = function(self, room, use)
    local player = use.from
    local target = use.tos[1]
    local mark = target:getMark("@[rfenghou_3d17j__lanjiao]rfenghou_3d17j__lanjiao")
    local arr = mark.all
    local pos = mark.pos
    local swapper = arr[pos]
    if swapper then
      arr[pos] = player.general
      room:addTableMark(target, "_rfenghou_3d17j__xianyan", player.id)
      room:changeHero(player, swapper, nil, nil, true, nil, true)
      room:setPlayerMark(target, "@[rfenghou_3d17j__lanjiao]rfenghou_3d17j__lanjiao", mark)
    else
      GameEvent.ChangeProperty:create(PropertyChangeData:new{
        from = player,
        gender = General.Female,
        sendLog = true,
        results = {},
      }):exec()
    end
  end
})

Fk:loadTranslationTable{
  ["rfenghou_3d17j__xianyan&"] = "献艳",
  [":rfenghou_3d17j__xianyan&"] = "每局限一次，出牌阶段，你可以将性别改为女，然后以自己替换“神·董卓”身下的武将牌。<br>" ..
  "<a href=':programmer_rfenghou_3d17j__xianyan&'>实际上……？</a>",

  [":programmer_rfenghou_3d17j__xianyan&"] = "每局限一次，出牌阶段，你可以将性别改为女，然后以主将交换“神·董卓”的第（其已损失体力值）张“娇”。",

  ["#rfenghou_3d17j__xianyan&"] = "献艳：以你的主将交换“神·董卓”身下的“%arg”",
  ["#rfenghou_3d17j__xianyan&0"] = "献艳：以你的主将交换“神·董卓”身下的武将牌",
  ["#rfenghou_3d17j__xianyan&-change"] = "献艳：将你的性别改为女",
}

return xianyan
